package javao.cn.modules.business.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javao.cn.modules.business.entity.SysLunboEntity;
import javao.cn.modules.business.service.SysLunboService;
import javao.cn.common.utils.PageUtils;
import javao.cn.common.utils.R;



/**
 * 轮播图管理
 *
 * @author admin?
 * @email 1372065855@qq.com
 * @date 2024-12-03 19:50:00
 */
@RestController
@RequestMapping("business/syslunbo")
public class SysLunboController {
    @Autowired
    private SysLunboService sysLunboService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("business:syslunbo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysLunboService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("business:syslunbo:info")
    public R info(@PathVariable("id") Long id){
		SysLunboEntity sysLunbo = sysLunboService.getById(id);

        return R.ok().put("sysLunbo", sysLunbo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("business:syslunbo:save")
    public R save(@RequestBody SysLunboEntity sysLunbo){
		sysLunboService.save(sysLunbo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("business:syslunbo:update")
    public R update(@RequestBody SysLunboEntity sysLunbo){
		sysLunboService.updateById(sysLunbo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("business:syslunbo:delete")
    public R delete(@RequestBody Long[] ids){
		sysLunboService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
